﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace InfoPathHelpers.UserRoles
{
    public class UserRole
    {
        private List<UserAssignment> _UserAssignments;

        public UserRole(string name, bool isDefault, bool isInitiator, List<UserAssignment> userAssignments)
        {
            Name = name;
            IsDefault = isDefault;
            IsInitiator = isInitiator;
            _UserAssignments = userAssignments;
        }

        public string Name { get; private set; }
        public bool IsDefault { get; private set; }
        public bool IsInitiator { get; private set; }
        public ReadOnlyCollection<UserAssignment> UserAssignments { get { return new ReadOnlyCollection<UserAssignment>(_UserAssignments); } }

        public void AddUserAssignment(UserAssignment userAssignment)
        {
            if (!_UserAssignments.Contains(userAssignment))
            {
                _UserAssignments.Add(userAssignment);
            }
        }
    }
}
